<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div
      class="list"
      :class="{
        'list-one': props.info.showpieceList.length === 1,
      }"
    >
      <div class="list-content">
        <div
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          
          class="exhibits-item"
          :class="{
            'exhibits-item-one': index === 0,
            'exhibits-item-2': (index + 1) % 2 === 0,
          }"
          :style="{
            'z-index':index+1,
            backgroundImage:
              (index + 1) % 2 === 0
                ? `url(${publicUrls + 'free/style15/exhibitionStandStyle2bg2.webp'})`
                : `url(${publicUrls + 'free/style15/exhibitionStandStyle2bg1.webp'})`,
          }"
        >
          <div class="item-content" @click="viewImg(item.moduleId, item.id)">
            <div class="cover-parent">
              <div class="cover-box">
                <div class="cover">
                  <img v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')" alt="" />
                </div>
              </div>
            </div>
            <div class="items-title">
              <div class="title-content">
                {{ item.name }}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template> 
   
<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';

import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
</script>
   
<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
}
.list {
  display: flex;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0 0.625em;
  padding-top: 0.25rem;
}
.list-one {
  padding-left: 1.25em;
}
.list-content {
  
  display: flex;
  flex: 1;
  height: 640px;
  // -webkit-box-reflect: below -0px linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) { 
  z-index: 66;
} 

.exhibits-item { 
  display: flex;
  flex-direction: column;
  position: relative;
  width: 480px;
  height: 640px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding: 88px 139px 0px 139px;
  margin-left: -181px;
} 
.exhibits-item-one {
  margin-left: 0;
}
.exhibits-item-2 {
  // z-index: 8;
}
.item-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 204px;
}
.cover-parent {
  position: relative;
  width: 186px;
  height: 280px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.cover-box {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 186px;
  height: 280px;
  overflow: hidden;
}
.cover {
  position: relative;
  width: 186px;
  height: 280px;
  object-fit: contain;
  transition: all 0.3s;
  overflow: hidden;
  img {
    width: 186px;
    height: 280px;
    max-height: 100%;
    object-fit: contain;
    transition: all 0.3s;
  }
}
.item-content:hover {
  .items-title {
    opacity: 1;
  }
}
.items-title {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 204px;
  height: 48px;
  z-index: 23;
  margin-top: 58px;
  padding: 7px 13px 9px 9px;
}
.title-content {
  width: 182px;
  max-height: 32px;
  font-family: SourceHanSerifCN-Bold;
  font-size: 18px;
  line-height: 32px;
  text-align: center;
  color: rgba(255, 224, 177, 1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
